package com.yjht.online.generate.impl.sysparam;

import cn.hutool.core.bean.BeanUtil;
import com.yjht.online.arg.ArgParam;
import com.yjht.online.generate.Generate;
import com.yjht.online.generate.GlobalContext;
import com.yjht.online.generate.impl.sysparam.plat.kd.GenerateSysParamProssorkd;

import com.yjht.online.generate.impl.sysparam.plat.wkd.GenerateSysParamProssorWkd;
import com.yjht.online.generate.model.sysparam.SysParam;

public class SysParamGenerate implements Generate {



    @Override
    public void generate(ArgParam argParam) {

        SysParam sysParam = toSysParam(argParam);

        //快贷
        GenerateSysParamProssorkd generateProssorkd = new GenerateSysParamProssorkd();
        //微快贷
        GenerateSysParamProssorWkd generateSysParamProssorWkd = new GenerateSysParamProssorWkd();
        generateProssorkd.generateSysParam(sysParam);
        generateSysParamProssorWkd.generateSysParam(sysParam);

    }

    private SysParam toSysParam(ArgParam argParam){
        SysParam sysParam = new SysParam();
        String corpCd;
        if(GlobalContext.getCorpInfo() != null && GlobalContext.getCorpInfo().getCorpCd()!=null ){
            corpCd = GlobalContext.getCorpInfo().getCorpCd();
        } else {
            corpCd = "";
        }
        sysParam.setCorpCd(corpCd);
        BeanUtil.copyProperties(argParam,sysParam);

        return sysParam;

    }
}
